<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
<TITLE>LeMock</TITLE>
</HEAD>
<BODY>

<DIV CLASS="header" ID="header">
<H1>LeMock</H1>
</DIV>

<DIV CLASS="body" ID="page-DEVEL">
<ul id="main_menu">
  <li id="main_menu-README"><a    href="README.html"   >Readme</a></li>
  <li id="main_menu-COPYRIGHT"><a href="COPYRIGHT.html">License</a></li>
  <li id="main_menu-userguide"><a href="userguide.html">Userguide</a></li>
  <li id="main_menu-HISTORY"><a   href="HISTORY.html"  >History</a></li>
  <li id="main_menu-DEVEL"><a     href="DEVEL.html"    >Devel</a></li>
</ul>
<H1>Developer Notes</H1>
<P>
LeMock is implemented in Lua 5.1, but its source code is written as
literate documents, and usees the tool noweb to generate the .lua files.
The distributed source archive includes all the tangled files in the build
directory, to avoid dependending on noweb for installation.
</P>
<P>
The source is contained in the src directory in the form of literate
documents. To extract (tangle) the final files from the sources, the tool
<A HREF="http://www.cs.tufts.edu/~nr/noweb/">noweb</A> is needed.
</P>
<P>
The source files are meant to be tangled together all at once, because the
contents of a target file can be spread over several source files. The
target files are all the chunk names that are roots. These can be found
with noroots in the noweb toolbox. To automate the tangle process, there is
a custom script named autotangle in the tools directory. This script finds
all the target file names and tangles them in the current directory,
creating subdirectories as needed. The script is written for yet another
obscure tool, <A HREF="http://www.libra-aries-books.co.uk/software/rc">rc</A> [1]. It
is probably easy to port the short rc script to your favourit language. It
is invoked (in rc syntax) as:
</P>
<PRE>
../tools/autotangle `{find ../src -name '*.nw'}
</PRE>
<P></P>
<P>
which means it wants all (recursively) .nw files in the src directory as
arguments.
</P>
<P>
The documentation is written in <A HREF="http://txt2tags.sourceforge.net/">txt2tags</A>,
which can generate HTML among many other formats. The README, HISTORY,
COPYRIGHT, and this DEVEL text file are written as simple txt2tags
documents to remain readable as is. The .nw source files define wrapper
txt2tags documents for the web pages, which use txt2tags' include mechanism
to include the actual txt2tags files. The user guide is defined in the .nw
sources as a separate txt2tags document, so it can be easily generated as a
LaTeX document or Unix man page, but it too is included in a wrapper
txt2tags document when generating the web pages.
</P>
<P>
The building of the web pages is done with
<A HREF="http://en.wikipedia.org/wiki/Mk_%28software%29">mk</A>, a Unix port of the
Plan9 make tool. (The mk files uses rc syntax.)
</P>
<P>
A set of unit tests (defined in the .nw source) can be run with
<A HREF="http://www.nessie.de/mroth/lunit/index.html">lunit</A> with the command:
</P>
<PRE>
lunit unit/*.lua
</PRE>
<P></P>
<P>
A program like <A HREF="http://luacov.luaforge.net/">luacov</A> can be used to check
the coverage of the unit tests.
</P>
<HR NOSHADE SIZE=1>
<H2>Footnotes</H2>
<DL>
<DT>[1]</DT><DD>
  I use Byron's Unix port, which syntax is extended and incompatible with
  the original (and other ports).
</DL>

<HR NOSHADE SIZE=1>
<P>
2009-05-31
</P>
</DIV>

<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags -t html -i www/DEVEL.t2t -o htdocs/DEVEL.html -->
</BODY></HTML>
